#include <stddef.h>
#include <stdio.h>
#include <unistd.h>
#include <pthread.h>
#include <stdlib.h>
#include <string.h>
typedef struct MSG
{
    int num;
    char * ptr;
}msg;

void print_msg(msg * mptr)
{
    int i = 0;
    for(i=0; i < 20 ; i++)
    {
	printf("msg num is %d , msg str is %s\n",mptr->num,mptr->ptr);
    }
}

int main()
{
    pthread_t thread1;
    void * retval;
    msg * mptr = NULL;
    mptr = (msg *)malloc(sizeof(msg));
    mptr->num = 5;
    mptr->ptr = (char *)malloc(50*sizeof(char));
    memcpy(mptr->ptr,"HELLO",6);
    if(mptr == NULL)
    {
       printf("mptr == NULL\n"); 
    }
    pthread_create(&thread1,NULL,(void *)(&print_msg),(void *)mptr);
    pthread_join(thread1,&retval);    
    return 0;
}
